//用于实现寄生式继承的公共方法    Inherit.js
/*
*使用说明：调用Inherit的inheritPrototype方法实现寄生继承。
* //Hawkeye:
*
* function inheritObject(o){
    function F(){};
        F.prototype = o;
        return new F();
}
function inheritPrototype(subClass,superClass){
    var p = inheritObject(superClass.prototype);
        p.constructor = subClass;
        subClass.prototype = p;
}

var NewClass = function(){
    this.value = "1312";
};
NewClass.prototype.getValue = function(){
    console.log(this.value);
};

var OldClass = function(prase){
    NewClass.call(this,prase);                  //关键调用函数值
    this.time = "123132123";
    
};
//启用寄生式继承
inheritPrototype(OldClass,NewClass);

//子类创建原型方法
OldClass.prototype.getTime = function(){
	console.log(this.time);
}
var a = new OldClass();
console.log(a);


////Console////
OldClass {
\value: "1312",
 time: "123132123"
 }
 time: "123132123"
 value: "1312"
 __proto__: NewClass
 constructor: ƒ (prase)
 getTime: ƒ ()
 arguments: null
 caller: null
 length: 0
 name: ""
 prototype: {constructor: ƒ}
 __proto__: ƒ ()
 [[FunctionLocation]]: VM170:25
 [[Scopes]]: Scopes[2]
 __proto__: Object
 getValue: ƒ ()
 arguments: null
 caller: null
 length: 0
 name: ""
 prototype: {constructor: ƒ}
 __proto__: ƒ ()
 [[FunctionLocation]]: VM170:15
 [[Scopes]]: Scopes[2]
 constructor: ƒ ()
 __proto__: Object
*
*
*
* Daniel
* 2018.03.01
*
*
* */

define(function(){
    var Inherit = {
        inheritPrototyoe: function(subClass, superClass){
            var p = inheritObject(superClass.prototype);
                p.constructor = subClass;
                subClass.prototype = p;
        }
    };
    function inheritObject (o) {
        function F(){}
        F.prototype = o;
        return new F();
    }
    return Inherit;
});